package com.system.manager.modules.risk.controller;


import com.system.manager.common.annotation.CurrSubject;
import com.system.manager.common.annotation.PreAuthorize;
import com.system.manager.common.entity.Result;
import com.system.manager.modules.authorized.entity.Subject;
import com.system.manager.modules.authorized.enums.SubjectType;
import com.system.manager.modules.risk.dto.StaffStationVo;
import com.system.manager.modules.risk.entity.TbAssessment;
import com.system.manager.modules.risk.service.IStaffStationService;
import com.system.manager.modules.risk.service.ITbAssessmentService;
import com.system.manager.modules.risk.vo.UserDate;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yxp
 * @since 2021-11-11
 */
@Slf4j
@Api(tags = "评估表")
@RestController
@RequestMapping("/risk/tb-assessment/")
public class TbAssessmentController {

    @Autowired
    private ITbAssessmentService iTbAssessmentService;

    @ApiOperation("生成评估表")
    @PreAuthorize({SubjectType.SYSTEM_ADMIN,SubjectType.RISK_ADMIN})
    @GetMapping("makeAssessment")
    public Result makeAssessment(@CurrSubject Subject subject){
        UserDate<TbAssessment> tbAssessmentUserDate = iTbAssessmentService.makeAssessage(subject);
        return new Result(tbAssessmentUserDate.getCode(),tbAssessmentUserDate.getMsg(),tbAssessmentUserDate.getData(),tbAssessmentUserDate.getCount());
       /* UserDate<TbExam> exam = iTbExamService.findExam(subject);
        return new Result(exam.getCode(), exam.getMsg(),exam.getData(),exam.getCount());*/
    }
}
